/**
 * @author lk
 * @date 2022/6/2 10:04
 */
package com.mmall.spring5.dao.impl;

import com.mmall.spring5.dao.BookDao;
import com.mmall.spring5.entity.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class BookDaoImpl implements BookDao {

    @Autowired
    private JdbcTemplate template;

    public Integer addBook() {
        String sql = "insert into book values(?,?)";
        Book book = new Book();
        book.setId(1);
        book.setName("Python");
        Object[] args = {book.getId(), book.getName()};
        int update = template.update(sql, args);
        return update;
    }

    @Override
    public void reduce() {

    }

    @Override
    public void add() {

    }
}

